package com.jt.vo;

/* 接口文档,   实现前后端作用*/

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;

@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class SysResult implements Serializable { //规范写法. 实现序列化接口.
    private  Integer status;
    private  String msg;
    private   Object data;

    /*为了用户使用vo对象,更加的方便重载一写方法简化程序的调用*/
    public static SysResult fail(){
        return   new SysResult(201,"业务执行失败",null);
    }

    public  static  SysResult success(){
        return  new SysResult(200,"业务执行成功",null);
    }

    public  static  SysResult success(Object data){
        return  new SysResult(200,"成功",data);
    }
    public  static  SysResult success(String msg,Object data){
        return  new SysResult(200,msg,data);
    }

    /*业务逻辑出错,方法重载出现耦合,jvm解析会出现选择错误. */
//    public  static  SysResult success(String msg){
//        return  new SysResult(200,msg,null);
//    }



}
